<div id="settingsProductionUsers" style="height:100%">
        <div class="ui-layout-center">
            <div class="clearfix tbl settingsProductionUsersTable" id="settingsProductionUsersTable"></div>    
        </div>
        <div class="ui-layout-south">
            <button class="small">Save</button>    
            <button class="small">Cancel</button>
        </div>
</div>
<script>
    var SettingsProductionUsersFX = function() {
        var _self = this;
        _self.perform = function() {
            //dodavanje layout-a za parent div
            $("#settingsProductionUsers").layout({
                resizable: false,
                closable: false,
                south__size: "50"
            });
            $("#settingsProductionUsersTable").addScroll();
            _self.loadDataForSettingsProductionUsersTable();

            window.refreshAndSortTable = _self.refreshSortedTable;
        };
        _self.refreshSortedTable = function(table, columnName, ascDesc, callback){
            _self.table = table;
            _self.request = 640;

            _self.columnName = columnName;
            _self.sortItem = "";
            _self.ascDesc = ascDesc;
            _self.action = "getItems";

            _self.random = Math.random();
            _self.url = "js/tableParams/" + _self.request + ".json?x=" + random;

            $.get(_self.url, function(response) {
                $(response.desc).each(function(index,value){
                    if(value.title == columnName){
                        _self.sortItem = value.param;
                        return false;
                    }
                });

                var params = {
                    request: _self.request,
                    action: _self.action,
                    sortItem: _self.sortItem,
                    ascDesc: _self.ascDesc
                };

                window.tableConstructor.generateTable(params, callback);
            });

        };

        _self.loadDataForSettingsProductionUsersTable = function(callback) {
            var params = {
                request: 640,
                action: "getItems"
            };
            window.tableConstructor.generateTable(params, callback);
        };
    };
    if(!window.sProductionUsersFX){
        window.sProductionUsersFX = new SettingsProductionUsersFX();
        window.sProductionUsersFX.perform();
        //window.sProductionUsersFX.clearEventHandlers();
        //window.sProductionUsersFX.assignEventHandlers();
    }
    else{
        window.sProductionUsersFX.perform();
        //window.sProductionUsersFX.clearEventHandlers();
        //window.sProductionUsersFX.assignEventHandlers();
    }
</script>